package com.csweimei.rentmanagementtreasure.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.http.entity.SearchStaffBean;

public class SearchStaffAdapter extends BaseQuickAdapter<SearchStaffBean.DataDTO, BaseViewHolder> {
    public SearchStaffAdapter() {
        super(R.layout.item_search_staff);
    }

    int flag = -1;

    public void setSel(int index){
        flag = index;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, SearchStaffBean.DataDTO dataDTO) {
        baseViewHolder.setText(R.id.tv_name,dataDTO.getName());
        baseViewHolder.setText(R.id.sex,dataDTO.getSex());
        baseViewHolder.setText(R.id.tv_tel,dataDTO.getPhone());

        if (getItemPosition(dataDTO) == flag){
            baseViewHolder.setImageResource(R.id.sel,R.mipmap.icon_cb_check);
        }else {
            baseViewHolder.setImageResource(R.id.sel,R.mipmap.icon_cb_pre);
        }


    }
}
